;
; Copyright (c) Microsoft Corporation.  All rights reserved.
;
;
; Use of this source code is subject to the terms of the Microsoft end-user
; license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
; If you did not accept the terms of the EULA, you are not authorized to use
; this source code. For a copy of the EULA, please see the LICENSE.RTF on your
; install media.
;
; Programmer: Visual.Wei
; Date: 2007-4-16


		INCLUDE kxarm.h
		INCLUDE armmacros.s
		INCLUDE s3c2443.inc


	TEXTAREA
	
;====================================
; MMU Cache/TLB/etc on/off functions
;====================================
R1_I	EQU	(1<<12)
R1_C	EQU	(1<<2)
R1_A	EQU	(1<<1)
R1_M    EQU	(1)
R1_IA	EQU	(1<<31)
R1_NF   EQU	(1<<30)	

	
;-------------------------------------------------------------------------------
;
;  Function:  void MMU_SetFastBusMode(void)
;
;  FCLK:HCLK= 1:1
	LEAF_ENTRY MMU_SetFastBusMode	

	mrc p15,0,r0,c1,c0,0	
	bic r0,r0,#R1_IA:OR:R1_NF
	mcr p15,0,r0,c1,c0,0	
	bx lr

;-------------------------------------------------------------------------------
;
;  Function: void MMU_SetAsyncBusMode(void)
;
; FCLK:HCLK= 1:2
	LEAF_ENTRY MMU_SetAsyncBusMode
	mrc p15,0,r0,c1,c0,0
	orr r0,r0,#R1_NF:OR:R1_IA
	mcr p15,0,r0,c1,c0,0
	bx lr


 	
;-------------------------------------------------------------------------------
;
;  Function:  _delay(uint32 val)
;
	LEAF_ENTRY _delay
	
5	subs    r0, r0, #1
	bne     %B5
	bx          lr
	;-------------------------------------------------------------------------------
;
;  Function:  _OUTREG32_delay(uint32 address,uint32 val)
;
	LEAF_ENTRY _OUTREG32_delay
	
	str	r1,[r0]
	nop	
	nop
	nop
	nop
	nop
	nop
	nop
	;
	nop
	nop
	nop
	bx          lr

;-------------------------------------------------------------------------------
;
;  Function:  _OUTUPLLCON(uint32 val)
;
	LEAF_ENTRY _OUTUPLLCON
	
	;Configure UPLL
	;--ldr	r1,=UPLLCON  
	str	r0,[r1]
	; Caution: After UPLL setting, at least 7-clocks delay must be inserted for setting hardware be completed.
	nop	
	nop
	nop
	nop
	nop
	nop
	nop
	bx          lr
	END
	
